<template>
  <el-container class="home-container">
    <!--头部区域-->
    <el-header>
      <div class="logo-box">
        <img src="../../assets/img/heima.png" alt>
        <span>电商后台管理系统</span>
      </div>
      <el-button type="info" @click="logout">退出</el-button>
    </el-header>
    <el-container>
      <!--左侧区域-->
      <el-aside :width="leftshow ? '65px' : '200px'">
        <el-menu
          background-color="#333744"
          text-color="#fff"
          active-text-color="#409EFF"
          :unique-opened="true"
          :collapse="leftshow ? true : false"
          :collapse-transition="false"
          :router="true"
        >
          <div class="toggle_bar" @click="leftshow=!leftshow" :style="leftshow ? 'width:65px;' : 'width:200px'">|||</div>
          <el-submenu
            :index="v.id + ''"
            v-for="(v,k) in menulist"
            :key="v.id"
            :style="leftshow ? 'width:65px;' : 'width:200px'"
          >
            <template slot="title">
              <i :class="'iconfont'+' '+iconlist[k]"></i>
              <span>{{v.authName}}</span>
            </template>
            <el-menu-item :index="'/'+vv.path" v-for="vv in v.children" :key="vv.id">
              <i class="el-icon-menu"></i>
              <span>{{vv.authName}}</span>
            </el-menu-item>
          </el-submenu>
        </el-menu>
      </el-aside>
      <!--右侧区域xiugai-->
      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
import mix from './Home-mixins.js'
// 通过mixins给vue做具体设置，好处是还可以再增加成员，新成员和mixins会做合并处理
export default {
  mixins: [mix]
  // created() {
  //   console.log('ooo')
  // }
}
</script>

<style lang="less" scoped>
.el-container {
  height: 100%;
  .el-header {
    background-color: #373d41;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    padding-right: 20px;
    .logo-box {
      display: flex;
      color: white;
      font-size: 22px;
      align-items: center;
      // 禁止被用户选中
      user-select: none;
      img {
        width: 50px;
        height: 50px;
        margin-right: 10px;
      }
    }
  }
  .el-aside {
    background-color: #333744;
  }
  .el-main {
    background-color: #eaedf1;
  }
  // 折叠和展开样式
  .toggle_bar {
    height: 25px;
    background-color: rgb(74, 80, 100);
    text-align: center;
    letter-spacing: 0.1em;
    color: #fff;
    font-size: 12px;
    line-height: 25px;
    user-select: none;
    cursor: pointer;
  }

}
</style>
